var windowName = "location";
var Page,bMap,list
apiready = function(){
    onWindowShow(function () {
        console.log(windowName + " show")
        // getData(Page)
    })
    onWindowHide(function () {
        console.log(windowName + " hide")
    })
    console.log("index page is OK");
    list = new List()
    Page = createVM("#Page",{
        //页面数据
        type:"in",
        lon:117.991683,
        lat: 37.399625,
        name:"",
        list:[],
    },{
        //页面方法
        "init":function () {
            var _this = this;
            list.setUrl("/app/location")
                .setAnimateFunc(function () {
                    startPullDownRefresh();
                }).setCbFunc(function (data) {
                stopPullDownRefresh()
                _this.list = data
                }).getList()

        },
        OnPullDownRefresh:function () {
            list.reload()
        },
        OnPullUpLoadMore:function () {
            list.getList()
        },
        del:function (index) {
            var en = this.list[index]
            apiPost("/app/location/del",{id:en.Location_id},function (res) {

                logJson(res)
                list.reload()
            })
        }
    })
    Page.init()

}
